<!DOCTYPE html>
<html lang="en">
    <head>
        <meta charset="UTF-8">
        <title>Title</title>
        <link href="https://cdn.bootcss.com/twitter-bootstrap/3.0.1/css/bootstrap.min.css" rel="stylesheet">
    </head>
    <body>
        <div class="container">
            <div class="row clearfix">
                <div class="col-md-12 column">
                    <h1 class="text-center">
                        新增预存款信息
                    </h1>
                    <h3 class="text-right text-success">
                        欢迎您:XXX
                        <#--<@shiro.principal property="name" />-->
                    </h3>

                        <div class="container">
                            <div class="row clearfix">
                                <div class="col-md-12 column">
                                    <div class="row clearfix">
                                        <div class="col-md-2 column">
                                        </div>
        <div class="col-md-6 column">
            <form class="form-horizontal" role="form" id="form">

                <div class="form-group">
                    <label for="pid" class="col-sm-2 control-label">客户名称</label>
                    <div class="col-sm-10">
                        <select name="pid" class="form-control" id="pid">
                            <option value="0">请选择客户</option>
                            <#if clientList?exists>
                                <#list clientList as client>
                                    <option value="${client.pid?if_exists}"
                                    >${client.clientName}</option>
                                <#--<option value="${model.id?if_exists}" <#if menu.parentId== model.id>selected</#if>>${model.name}</option>-->
                                </#list>
                            </#if>
                        </select>
                    </div>
                </div>


                <div class="form-group">
                    <label for="fundType" class="col-sm-2 control-label">款项类型</label>
                    <div class="col-sm-10">
                        <select id="fundType" name="fundType" class="form-control">
                            <option selected>预存</option>
                            <option >支出</option>
                        </select>
                    </div>
                </div>

                <div class="form-group">
                    <label for="rid" class="col-sm-2 control-label">预存规则</label>
                    <div class="col-sm-10">
                        <select name="rid" class="form-control" id="rid">
                            <option value="-1">请选择预存款规则</option>
                            <option value="0">不使用预存款规则</option>
                            <#if ruleList?exists>
                                <#list ruleList as rule>
                                    <option value="${rule.rid?if_exists}"
                                    >${rule.ruleName}</option>
                                <#--<option value="${model.id?if_exists}" <#if menu.parentId== model.id>selected</#if>>${model.name}</option>-->
                                </#list>
                            </#if>
                        </select>
                    </div>
                </div>

                <div class="form-group">
                    <label for="moeny" class="col-sm-2 control-label">金额</label>
                    <div class="col-sm-10">
                        <input type="text" class="form-control" id="moeny"
                        name="moeny"/>
                    </div>
                </div>

                <div class="form-group">
                    <label for="content" class="col-sm-2 control-label">备注</label>
                    <div class="col-sm-10">
                        <input type="text" class="form-control" id="content"
                               name="content"/>
                    </div>
                </div>


                <div class="form-group">
                    <label for="operationDate" class="col-sm-2 control-label">业务时间</label>
                    <div class="col-sm-10">
                        <input type="date" class="form-control" id="operationDate"
                               name="operationDate"/>
                    </div>
                </div>



                <div class="form-group">
                    <div class="col-sm-offset-2 col-sm-10">
                        <button type="button" class="btn btn-success"
                        onclick="accountSubmit()">提交</button>
                        <button type="button" class="btn btn-info"
                                onclick="history.back()">返回</button>
                    </div>
                </div>
            </form>
        </div>
            <div class="col-md-4 column">
                <div class="form-group">
                    <div class="col-sm-offset-2 col-sm-10">
                        <button type="button" class="btn btn-success"
                        onclick="location.href='/prefund/add-ui'">添加新的预存款信息</button>
                    </div>
                </div>
            </div>
                                    </div>
                                </div>
                            </div>
                        </div>
                    </form>
                </div>
            </div>
        </div>
        <script src="/static/js/jquery-1.8.0.min.js" ></script>
        <script>


            //添加预存款订单信息
            function accountSubmit(){
                //1. 获取form表单中的全部内容
                var data = $("#form").serialize(); // 将携带name属性的表单项拼接为key=value&key=value..
                //2. 发送ajax请求到后台,并传递全部的参数.
                $.post(
                    "/prefund/order/add",
                    data,
                    function(result){
                        if(result.code == 0){
                            alert(result.msg)
                            location.href = "/prefund/list";
                        }
                    },
                    "json"
                );
            }
        </script>
    </body>
</html>